home *** CD-ROM | disk | FTP | other *** search
/ Fritz: All Fritz / All Fritz.zip / All Fritz / FILES / COMMADIO / KERMIT1.LZH / PCDOWNLO.DOC < prev    next >
Text File  |  1980-01-01  |  9KB  |  233 lines

  1. 4.4. 8086/8088
  2.  
  3. If  you  need to install Kermit on your PC, and you do not have a Kermit floppy
  4. but you do have access to a mainframe computer with a copy of the IBM PC Kermit
  5. distribution, you should read this section.
  6.  
  7. Kermit for the IBM PC is written in  assembly  language.    The  PC  assembler,
  8. however, is not provided with the minimum system, so IBM PC users cannot be ex-
  9. pected to have it.  Assembler source plus the runnable version (.EXE) of Kermit
  10.                19
  11. are distributed  , along with some special "bootstrap" files, described below:
  12.  
  13. The KERMIT.EXE file is converted by an assembler program on the PC, KFIX, which
  14. makes  all  bytes  in the file printable by breaking each one up into two 4-bit
  15. "nibbles" and adding a constant.    The  result  is  a  printable  file  called
  16. KERMIT.FIX.    It is assumed that a copy of KERMIT.FIX is available to you on a
  17. mainframe computer.  To download the file to the PC, two  cooperating  programs
  18. are  run: a Fortran program, KSEND, on the mainframe and a Basic program, KGET,
  19. on the PC.  These programs are very short; they are  shown  in  their  entirety
  20.  
  21. _______________
  22.  
  23.   19
  24.     The  PC  assembler's  object  (.OBJ) files are not printable, like CP/M hex
  25. files, so the Kermit-80 bootstrapping technique would not work here.
  26.                                     - 42 -
  27.  
  28.  
  29. below.  KSEND reads a line at a time from KERMIT.FIX, types the line, and waits
  30. for  a  signal  from KGET that it can send more data.  KGET reads each line and
  31. converts the text back to the format of an executable (.EXE) file.  Here's  the
  32. procedure:
  33.  
  34.    1. You  should  have  a  version  of  KGET  on  the PC and KSEND on the
  35.       mainframe; if you don't have them, copy  them  (i.e. type  them  in,
  36.                      20
  37.       using an editor  ) from the listings below.
  38.  
  39.    2. Log  in  on the mainframe.  This could be tricky if you have no ter-
  40.       minal  emulation  facility  on  the  PC.    If  you  have  the   IBM
  41.       asynchronous  communication  package,  you can do this at low speeds
  42.       (baud rates).  If your PC has no terminal emulation facility, you'll
  43.       have to use a real terminal to log in, and then switch the cable  to
  44.       the PC.
  45.  
  46.    3. Compile  KSEND.FOR on your mainframe, if it needs compiling.  Define
  47.       logical unit numbers 5 and 6 to be  the  controlling  terminal,  and
  48.       logical unit number 7 to be KERMIT.FIX.  On the DEC-20, for example:
  49.  
  50.           @define 5: tty:
  51.           @define 6: tty:
  52.           @define 7: kermit.fix
  53.  
  54.       On a DECsystem-10, do something like:
  55.  
  56.           .assign tty: 5:
  57.           .assign tty: 6:
  58.           .assign dsk: 7:
  59.           .rename for007.dat=kermit.fix
  60.  
  61.       On an IBM system under VM/CMS,
  62.  
  63.           .filedef 5 term ( lrecl 64 recfm f
  64.           .filedef 6 term ( lrecl 64 recfm f
  65.           .filedef 7 disk kermit fix ( lrecl 64 recfm f perm
  66.  
  67.       Start KSEND on the mainframe.  It will print a message, and then sit
  68.       and  wait for the PC to send back an OK; don't change any connectors
  69.       until you see the message.
  70.  
  71.    4. Escape back to the PC, or connect the PC to the mainframe.  The PC's
  72.       communication port should be connected with a null  modem  cable  to
  73.       the  modem  that's  connected  to  the mainframe (dialup, dedicated,
  74.       switched, whatever hookup you normally have available for logging in
  75.       on the mainframe from a terminal).  If you were  using  a  different
  76.       terminal  to  log in to the mainframe, make sure the PC's communica-
  77.       tion port is set at the same speed.
  78.  
  79.    5. Enter BASIC and run KGET on the PC.  If KGET prints  messages  about
  80.  
  81. _______________
  82.  
  83.   20
  84.     You'll also have to compile and load the Fortran program on the mainframe.
  85.                                     - 43 -
  86.  
  87.  
  88.       i/o  errors,  run  it again.  If it still gets errors, reboot the PC
  89.       and try again.  Once KGET is running, the transmission  will  begin.
  90.       KGET will print each 64-character line of nibbles as it arrives from
  91.       the  mainframe.  Each line should be the same length -- if you see a
  92.       ragged edge, you can assume there has been a transmission error, and
  93.       you should start the process again.
  94.  
  95.    6. When transmission is complete, you'll see the BASIC  "Ready"  prompt
  96.       again.    Leave  BASIC  by  typing  SYSTEM.    You  should  now have
  97.       KERMIT.EXE on your PC.  Try to run it.  If you see the  "Kermit-86>"
  98.       prompt,  try  to  CONNECT  to  the  host mainframe and transfer some
  99.       files.  If Kermit doesn't run correctly, there may have been  trans-
  100.       mission  errors,  in  which  case you should start the process again
  101.       from step 2 above.
  102.  
  103. This is the mainframe side, KSEND, in transportable Fortran (it should  run  on
  104. both DEC and IBM mainframes):
  105.  
  106. C KSEND -- Download a file over the terminal line. No special checking is done,
  107. C except to wait for response (any response at all) from other side.
  108. C
  109. C This Fortran program should be run on the mainframe in conjunction
  110. C with the KGET program on the IBM PC to transfer KERMIT.FIX to the PC.
  111. C
  112. C Daphne Tzoar, CUCCA, Jan 83
  113.  
  114.       INTEGER A(64)
  115.  
  116.       WRITE(6,50)
  117. 50    FORMAT(' Ready to transfer data......')
  118.  
  119. C - Get terminal handshake
  120. 100   READ (5,10,END=35)X
  121. 10    FORMAT(A1)
  122.  
  123. C - Get line from file
  124. 35    READ (7,20,END=90)A
  125. 20    FORMAT(64A1)
  126.  
  127. C - Write to tty
  128.       WRITE (6,25)A
  129. 25    FORMAT(' ',64A1,';')
  130.       GOTO 100
  131. 90    CONTINUE
  132.  
  133. C - Send final handshake
  134.       WRITE (6,30)
  135. 30    FORMAT(' ',65('@'))
  136.       STOP
  137.       END
  138.  
  139. The  final @'s tell KGET that the transmission is done.  This works because the
  140. technique for forming KERMIT.FIX ensures that the file will contain no @'s.
  141.  
  142. This is the PC side, KGET, in PC Basic.  Note that the  communication  port  is
  143. opened at 4800 baud (you could substitute any other speed).
  144.                                     - 44 -
  145.  
  146.  
  147. 1   'KGET.BAS
  148.  
  149. 5   'Run this program on the PC in conjunction with a Fortran program on the
  150. 6   'mainframe to get Kermit to the PC.  Daphne Tzoar, CUCCA, Jan 83
  151.  
  152. 10   OPEN "com1:4800,n,8,1" AS #1  ' Clear the port status.
  153. 20   CLOSE #1
  154. 30   OPEN "com1:4800,n,8,1,cs,ds,cd" AS #1 ' Open it for real.
  155. 40   OPEN "KERMIT.EXE" FOR OUTPUT AS #2
  156. 50   OK$ = "ok"
  157. 60   PRINT#1,OK$                   ' Tell host we're ready for data
  158. 70   X$=INPUT$(65,#1)              ' Data plus semi-colon
  159. 80   VALUE$ = LEFT$(X$,1)          ' First char of input
  160. 90   VALUE = ASC(VALUE$)
  161. 100  IF VALUE = 64 OR VALUE = 192 GOTO 430          ' @ means we're done
  162. 110  IF VALUE >= 160 AND VALUE <= 175 THEN GOTO 140 ' Kill all illegal chars
  163. 120  IF VALUE >= 32 AND VALUE <= 47 THEN GOTO 140
  164. 130  X$ = MID$(X$,2) : GOTO 80
  165. 140  IF VALUE <> 174 GOTO 210      ' Not a dot (for read) - don't worry
  166. 150  TWO$ = MID$(X$,2,1)           ' Look at char after the dot.
  167. 160  TWO = ASC(TWO$)
  168. 170  IF TWO >= 160 AND TWO <= 175 THEN GOTO 210     ' It's ok.
  169. 180  IF TWO >= 32 AND TWO <= 47 THEN GOTO 210
  170. 190  X$ = MID$(X$,3)               ' Kill the char
  171. 200  GOTO 80
  172. 210  SIZ = LEN(X$)                 ' How much input was actual data
  173. 220  READIN = 65 - SIZ
  174. 230  XTWO$=INPUT$(READIN,#1)       ' Get rest of data
  175. 240  X$ = X$ + XTWO$ : X$ = LEFT$(X$,64)
  176. 250  PRINT X$         ' Optional - use this line to follow the transmission
  177. 260  GOSUB 290
  178. 270  PRINT#2,X$;      ' Put data to the file.
  179. 280  GOTO 60
  180. 290  ' Get two chars, subtract space (20 hex) from each, and combine
  181. 300  ' to one digit.
  182. 310  FOR A = 1 TO 32
  183. 320    Y$ = MID$(X$,A,1)
  184. 330    Z$ = MID$(X$,A+1,1)
  185. 340    YNUM = ASC(Y$) : ZNUM = ASC(Z$)
  186. 350    IF YNUM > 127 THEN YNUM = YNUM - 128    ' Turn off hi bit if on
  187. 360    IF ZNUM > 127 THEN ZNUM = ZNUM - 128
  188. 370    YNUM = YNUM -32 : ZNUM = ZNUM -32       ' Subtract the space
  189. 380    XNUM = (16 * YNUM) +ZNUM
  190. 390    NEWCHR$ = CHR$(XNUM)
  191. 400    X$ = MID$(X$,1,A-1) + NEWCHR$ + MID$(X$,A+2)
  192. 410  NEXT A
  193. 420  RETURN
  194. 430  PRINT  " [All done.]"
  195. 440  CLOSE #1,#2                            ' Clean up.
  196. 450  END
  197.  
  198. If  you already have a working Kermit on your PC and you want to get a new one,
  199. you should use Kermit itself to transfer the KERMIT.FIX file.   Once  you  have
  200. the new KERMIT.FIX on your PC disk:
  201.  
  202.    1. Rename KERMIT.EXE to something else, so you'll still have it in case
  203.                                     - 45 -
  204.  
  205.  
  206.       something goes wrong.
  207.  
  208.    2. Modify KGET:
  209.  
  210.          a. Remove lines 10 and 20.
  211.  
  212.          b. Change line 30 to 
  213.  
  214.                 30   OPEN "KERMIT.FIX" FOR INPUT AS #1
  215.  
  216.          c. Remove line 60, since we're not handshaking with a remote host
  217.             any more.
  218.  
  219.          d. In line 70, change "65" to "64".
  220.  
  221.          e. Remove  line 250, since there's no need to monitor a transmis-
  222.             sion line.
  223.  
  224.          f. Change line 280 from "GOTO 60" to "GOTO 70".
  225.  
  226.    3. Save the modified KGET under a new name, say KEXE.BAS, and  run  it.
  227.       It  will end with some error like "Input past end in 70", which just
  228.       means it came to the end of file (of course, you  could  avoid  this
  229.       error by trapping it, but no harm is done in any case).
  230.  
  231.    4. You  should now have a new, working version of KERMIT.EXE on your PC
  232.       disk.
  233.